package com.project.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RestController
@RequestMapping("update")
public class UploadController {

    public String upload(@RequestParam("uploadImg") MultipartFile mf) throws IOException {
        String fileName =mf.getOriginalFilename();
        fileName = System.currentTimeMillis() + fileName.substring(fileName.lastIndexOf("."));

        mf.transferTo(new File("D:\\数据库\\Javaweb\\Dormitory\\src\\main\\java\\com\\project\\faceImg\\" + fileName));

        return fileName;
    }
}
